<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>下载</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    html,
    body {
      width: 100%;
      height: 100%;
    }

    .ios-container {
      width: 100%;
      height: 100%;
      position: relative;
      background: url('../image/base.png') no-repeat left top;
      background-size: contain;
      background-color: #fff;
    }

    .content {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }

    .logo img {
      display: block;
      width: 6rem;
      height: 6rem;
      margin: 0 auto;
    }

    .logo h3 {
      margin-top: 0.3rem;
      text-align: center;
    }

    .create-button {
      display: none;
      margin-top: 5rem;
    }

    .create {
      /* margin-top: 5rem; */
    }

    .create p {
      text-align: center;
      color: #a9b1b3;
      font-size: 12px;
    }

    .download {
      margin-top: 1.5rem;
      background-color: #259bec;
      border-radius: 2rem;
      color: #FFF;
    }

    .download img {
      width: 1rem;
      height: 1rem;
      display: block;
      margin-right: 0.5rem;
    }

    .download span {
      font-size: 13px;
    }

    .ios-download,
    .an-download {
      display: flex;
      display: -webkit-flex;
      justify-content: center;
      align-items: center;
      text-decoration: none;
      color: #fff;
    }

    .ios,
    .andriod {
      width: 8rem;
      height: 2rem;
      line-height: 2rem;
    }

    .not-download {
      margin-top: 5rem;
    }

    #bubble {
      position: absolute;
      top: 0;
      right: 0.5rem;
    }

    .bubble-content {
      background-color: #259bec;
      border-radius: 0.3rem;
      padding: 0.5rem;
      color: #eaeaea;
      font-size: 13px;
    }

    #bubble .triangle {
      position: relative;
      bottom: 0;
      right: -6.5rem;
      width: 0;
      height: 0;
      border-width: 0.5rem;
      border-style: solid;
      border-color: transparent transparent #259bec transparent;
    }

  </style>
</head>

<body>
  <div class="ios-container">
    <div class="content">
      <div class="logo">
        <img src="../image/bossIcon.jpg" alt="">
        <h3>店务通</h3>
      </div>
      <div class='create-button'>
        <div class="download">
          <div class='ios'>
            <!-- <a class="ios-download" href='https://itunes.apple.com/cn/app/微信/id414478124?mt=8'>
              <img src="../image/ios.png" alt="">
              <span class='downloadNow'>立即下载</span>
            </a> -->
            <p>ios版暂不支持下载，敬请期待...</p>
          </div>
          <div class="andriod">
            <a class="an-download" href='app-release.apk'>
              <img src="../image/andriod.png" alt="">
              <span class='downloadNow'>立即下载</span>
          </div>
          </a>
        </div>
      </div>
      <div class="not-download" style="display:none">
        <p>QQ、微信内无法下载应用</p>
      </div>
    </div>
    <div id="bubble" style="display:none">
      <div class="triangle"></div>
      <div class="bubble-content">
        <p>请点击右上角</p>
        <p>选择 "浏览器中打开"</p>
      </div>
      <!-- </div> -->
    </div>
  </div>
</body>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
  /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
  var saveAs = saveAs || function (e) {
    "use strict";
    if (typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
      return
    }
    var t = e.document,
      n = function () {
        return e.URL || e.webkitURL || e
      },
      r = t.createElementNS("http://www.w3.org/1999/xhtml", "a"),
      i = "download" in r,
      o = function (e) {
        var t = new MouseEvent("click");
        e.dispatchEvent(t)
      },
      a = /Version\/[\d\.]+.*Safari/.test(navigator.userAgent),
      f = e.webkitRequestFileSystem,
      u = e.requestFileSystem || f || e.mozRequestFileSystem,
      s = function (t) {
        (e.setImmediate || e.setTimeout)(function () {
          throw t
        }, 0)
      },
      c = "application/octet-stream",
      d = 0,
      l = 500,
      w = function (t) {
        var r = function () {
          if (typeof t === "string") {
            n().revokeObjectURL(t)
          } else {
            t.remove()
          }
        };
        if (e.chrome) {
          r()
        } else {
          setTimeout(r, l)
        }
      },
      p = function (e, t, n) {
        t = [].concat(t);
        var r = t.length;
        while (r--) {
          var i = e["on" + t[r]];
          if (typeof i === "function") {
            try {
              i.call(e, n || e)
            } catch (o) {
              s(o)
            }
          }
        }
      },
      v = function (e) {
        if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)) {
          return new Blob(["\ufeff", e], {
            type: e.type
          })
        }
        return e
      },
      y = function (t, s, l) {
        if (!l) {
          t = v(t)
        }
        var y = this,
          m = t.type,
          S = false,
          h, R, O = function () {
            p(y, "writestart progress write writeend".split(" "))
          },
          g = function () {
            if (R && a && typeof FileReader !== "undefined") {
              var r = new FileReader;
              r.onloadend = function () {
                var e = r.result;
                R.location.href = "data:attachment/file" + e.slice(e.search(/[,;]/));
                y.readyState = y.DONE;
                O()
              };
              r.readAsDataURL(t);
              y.readyState = y.INIT;
              return
            }
            if (S || !h) {
              h = n().createObjectURL(t)
            }
            if (R) {
              R.location.href = h
            } else {
              var i = e.open(h, "_blank");
              if (i == undefined && a) {
                e.location.href = h
              }
            }
            y.readyState = y.DONE;
            O();
            w(h)
          },
          b = function (e) {
            return function () {
              if (y.readyState !== y.DONE) {
                return e.apply(this, arguments)
              }
            }
          },
          E = {
            create: true,
            exclusive: false
          },
          N;
        y.readyState = y.INIT;
        if (!s) {
          s = "download"
        }
        if (i) {
          h = n().createObjectURL(t);
          r.href = h;
          r.download = s;
          setTimeout(function () {
            o(r);
            O();
            w(h);
            y.readyState = y.DONE
          });
          return
        }
        if (e.chrome && m && m !== c) {
          N = t.slice || t.webkitSlice;
          t = N.call(t, 0, t.size, c);
          S = true
        }
        if (f && s !== "download") {
          s += ".download"
        }
        if (m === c || f) {
          R = e
        }
        if (!u) {
          g();
          return
        }
        d += t.size;
        u(e.TEMPORARY, d, b(function (e) {
          e.root.getDirectory("saved", E, b(function (e) {
            var n = function () {
              e.getFile(s, E, b(function (e) {
                e.createWriter(b(function (n) {
                  n.onwriteend = function (t) {
                    R.location.href = e.toURL();
                    y.readyState = y.DONE;
                    p(y, "writeend", t);
                    w(e)
                  };
                  n.onerror = function () {
                    var e = n.error;
                    if (e.code !== e.ABORT_ERR) {
                      g()
                    }
                  };
                  "writestart progress write abort".split(" ").forEach(function (e) {
                    n["on" + e] = y["on" + e]
                  });
                  n.write(t);
                  y.abort = function () {
                    n.abort();
                    y.readyState = y.DONE
                  };
                  y.readyState = y.WRITING
                }), g)
              }), g)
            };
            e.getFile(s, {
              create: false
            }, b(function (e) {
              e.remove();
              n()
            }), b(function (e) {
              if (e.code === e.NOT_FOUND_ERR) {
                n()
              } else {
                g()
              }
            }))
          }), g)
        }), g)
      },
      m = y.prototype,
      S = function (e, t, n) {
        return new y(e, t, n)
      };
    if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
      return function (e, t, n) {
        if (!n) {
          e = v(e)
        }
        return navigator.msSaveOrOpenBlob(e, t || "download")
      }
    }
    m.abort = function () {
      var e = this;
      e.readyState = e.DONE;
      p(e, "abort")
    };
    m.readyState = m.INIT = 0;
    m.WRITING = 1;
    m.DONE = 2;
    m.error = m.onwritestart = m.onprogress = m.onwrite = m.onabort = m.onerror = m.onwriteend = null;
    return S
  }(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content);
  if (typeof module !== "undefined" && module.exports) {
    module.exports.saveAs = saveAs
  } else if (typeof define !== "undefined" && define !== null && define.amd != null) {
    define([], function () {
      return saveAs
    })
  }

</script>
<script type="text/javascript">
  $(function () {
    init();
  })

  function init() {
    window.onload = function () {
      var u = navigator.userAgent;
      var ua = navigator.userAgent.toLowerCase(); //获取判断用的对象
      var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端				
      var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
      var chat = ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/\sQQ/i) == "qq" //微信或者QQ
      if (isAndroid) {
        if (chat) {
          $('.not-download').css('display', 'block')
          $('#bubble').css('display', 'block')
        } else {
          $('.create-button').css('display', 'block')
          $('.andriod').css('display', 'block')
          $('.ios').css('display', 'none')
        }
      } else if (isiOS) {
        if (chat) {
          $('.not-download').css('display', 'block')
          $('#bubble').css('display', 'block')
        } else {
          $('.create-button').css('display', 'block')
          $('.andriod').css('display', 'none')
          $('.ios').css('display', 'block')
          $('.ios').css('width', '15rem')
          $('.ios').css('color', '#000')
          $('.download').css('backgroundColor', '#fff')
        }
      }
    }
  }

</script>

</html>
